package com.anolesoft.amljmes.fortysix.service.mapper;

import com.anolesoft.amljmes.fortysix.dto.MesBzzPtdDto;
import com.anolesoft.amljmes.fortysix.dto.MesBzzPtdmxDto;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface PtddeleteUpdateServiceMapper {
    // 删除
    @Delete("delete from mes_bzz_ptd where supporting_plan_pk = #{supportingPlanPk, jdbcType=VARCHAR} ")
    int deletePtd(String supportingPlanPk);

    // 修改
    @Update("update mes_bzz_ptd set " +
            "order_number = #{orderNumber, jdbcType=VARCHAR},batch = #{batch, jdbcType=VARCHAR},part_dispatch_number = #{partDispatchNumber, jdbcType=VARCHAR}," +
            "model = #{model, jdbcType=VARCHAR},bom_classification = #{bomClassification, jdbcType=VARCHAR},sorties = #{sorties, jdbcType=VARCHAR}," +
            "item_no = #{itemNo, jdbcType=VARCHAR},material_name = #{materialName, jdbcType=VARCHAR},drawing_no = #{drawingNo, jdbcType=VARCHAR}," +
            "quantity = #{quantity, jdbcType=NUMERIC},demand_time = to_date(#{demandTime, jdbcType=DATE},'yyyy-mm-dd'),dispatch = #{dispatch, jdbcType=VARCHAR}," +
            "customer = #{customer, jdbcType=VARCHAR},product_type = #{productType, jdbcType=NUMERIC},factory_code = #{factoryCode, jdbcType=VARCHAR}," +
            "delete_person = #{deletePerson, jdbcType=VARCHAR},delete_time = to_date(#{deleteTime, jdbcType=DATE},'yyyy-mm-dd')"+
            " where supporting_plan_pk = #{supportingPlanPk, jdbcType=VARCHAR}" )
    int updatePtd(MesBzzPtdDto inFoDtoParam);

    // 删除
    @Delete("delete from mes_bzz_ptdmx where details_pk = #{detailsPk, jdbcType=VARCHAR} ")
    int deletePtdmx(String detailsPk);

    // 修改
    @Update("update mes_bzz_ptdmx set " +
            "item_no = #{itemNo, jdbcType=VARCHAR},part_code = #{partCode, jdbcType=VARCHAR},part_drawing_no = #{partDrawingNo, jdbcType=VARCHAR}," +
            "drawing_no_of_station = #{drawingNoOfStation, jdbcType=VARCHAR},station_name = #{stationName, jdbcType=VARCHAR},material_type = #{materialType, jdbcType=VARCHAR}," +
            "manufacturing_unit = #{manufacturingUnit, jdbcType=VARCHAR},user_unit = #{userUnit, jdbcType=VARCHAR},product_source = #{productSource, jdbcType=NUMERIC}," +
            "demand_time = to_date(#{demandTime, jdbcType=DATE},'yyyy-mm-dd'),demand_quantity = #{demandQuantity, jdbcType=NUMERIC},quantity_of_missing_parts = #{quantityOfMissingParts, jdbcType=NUMERIC}," +
            "factory_code = #{factoryCode, jdbcType=VARCHAR},paigonghao = #{paigonghao, jdbcType=VARCHAR},jixing = #{jixing, jdbcType=VARCHAR}," +
            "jiaofuchejian = #{jiaofuchejian, jdbcType=VARCHAR},jieshouchejian = #{jieshouchejian, jdbcType=VARCHAR},jiaofushunxu = #{jiaofushunxu, jdbcType=VARCHAR}" +
            " where details_pk = #{detailsPk, jdbcType=VARCHAR}" )
    int updatePtdmx(MesBzzPtdmxDto inFoDtoParam);
}
